package com.ylbh.modules.coupon.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ylbh.common.pojo.coupon.dto.*;
import com.ylbh.common.pojo.coupon.vo.*;
import com.ylbh.modules.business.entity.ShoppingBusinessGoods;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 优惠券
 * @author czx
 * @date 2019-05-10
 */
@Mapper
@Repository
public interface CouponMapper extends BaseMapper<ShoppingBusinessGoods> {

    /**
     * 优惠券使用记录
     * @param usageRecordDTO
     * @param page
     * @return
     */
    List<UsageRecordVO> selectUsageRecordList(@Param(value = "usageRecordDTO")UsageRecordDTO usageRecordDTO, Page page);

    /**
     * 超级大玩家开通记录
     * @param openingRecordDTO
     * @param page
     * @return
     */
    List<OpeningRecordVO> selectOpeningRecordList(@Param(value = "openingRecordDTO")OpeningRecordDTO openingRecordDTO, Page page);

    /**
     * 优惠券领取记录
     * @param collectionRecordsDTO
     * @param page
     * @return
     */
    List<CollectionRecordsVO> selectCollectionRecordsList(@Param(value = "collectionRecordsDTO")CollectionRecordsDTO collectionRecordsDTO, Page page);

    /**
     * 优惠券信息列表
     * @param couponListDTO
     * @param page
     * @return
     */
    List<CouponListVO> selectCouponList(@Param(value = "couponListDTO")CouponListDTO couponListDTO, Page page);

    /**
     * 未审核的优惠券数量
     * @return
     */
    int selectUnauditedCount();

    /**
     * 优惠券的详情
     * @param goodsId
     * @return
     */
    CouponDetailsVO selectCouponDetailsById(@Param(value = "goodsId")Long goodsId);

    /**
     * 查询商家的详细地址
     * @param userId
     * @return
     */
    CouponAddressVO selectAddress(@Param(value = "userId")Long userId);

    /**
     * 优惠券商品上下架
     * @param goodsId
     * @param isSale
     */
    void updateUpperAndLowerFrames(String goodsId, String isSale);

    /**
     * 优惠券商品审核
     * @param couponPassDTO
     */
    void updateAdoptById(@Param(value = "couponPassDTO") CouponPassDTO couponPassDTO);
}
